import { getTodoLists } from "@/services/todo"

export default {
  namespace: "todo",
  state: {
    todos: []
  },
  effects: {
    *getTodo(_: any, { call, put }: any) {
      const data = yield call(getTodoLists);
      yield put({
        type: "setTodo",
        payload: data,
      })
    }
  },
  reducers: {
    setTodo(state: any, action: any) {
      return {
        ...state,
        todos: action.payload
      }
    }
  }
}